<?php
namespace Home\Controller;
use Think\Controller;

//小程序首页code登录
class CodeLoginController extends Controller {
    public function index(){
        //获取授权码
    	$where['auth_code'] = I('get.auth_code');
    	
    	//验证授权码是否存在，存在返回赛事信息
    	if($result = M('Event')->where($where)->find()){
    		$data['state']     = 1;
    		$data['info']      = '授权码通过';
            $data['event_id']  = $result['id']; //赛事id
    	}else{
    		$data['state']     = 0;
    		$data['info'] = '授权码不正确';
    	}
    	$this->ajaxReturn($data);
    }
}